﻿Imports System.Transactions
Imports Sistema_InformacionNaviera.BE
Imports Sistema_InformacionNaviera.DALC


Public Class BillOfLadingImpoBC

    Public Function InsertarBLImpo(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objBLImpoDALC As BillOfLadingImpoDALC = Nothing
                objBLImpoDALC = New BillOfLadingImpoDALC

                objBLImpoDALC.InsertarBLimportacion(objBlImpoBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function InsertarBLImpoContenedores(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objBLImpoDALC As BillOfLadingImpoDALC = Nothing
                objBLImpoDALC = New BillOfLadingImpoDALC

                objBLImpoDALC.InsertarBlImpoContenedor(objBlImpoBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function


    Public Function InsertarBLImpoMercaderia(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objBLImpoDALC As BillOfLadingImpoDALC = Nothing
                objBLImpoDALC = New BillOfLadingImpoDALC

                objBLImpoDALC.InsertarBlMercaderia(objBlImpoBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function InsertarBLImpoFletes(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objBLImpoDALC As BillOfLadingImpoDALC = Nothing
                objBLImpoDALC = New BillOfLadingImpoDALC

                objBLImpoDALC.InsertarBlImpoFlete(objBlImpoBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function


    Public Function ModificarBLimportacionCab(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objBLImpoDALC As BillOfLadingImpoDALC = Nothing
                objBLImpoDALC = New BillOfLadingImpoDALC

                objBLImpoDALC.InsertarBLimportacion(objBlImpoBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

    Public Function ListarBlImpo(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef dt As DataTable, ByRef sMensaje As String) As List(Of BillOfLadingImpoBE)
        Dim objListaBlList As List(Of BillOfLadingImpoBE) = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        objListaBlList = New List(Of BillOfLadingImpoBE)()
        objListaBlList = objBlImpoDALC.ConsultarBLImportacion(objBlImpoBE, dt, sMensaje)

        Return objListaBlList
    End Function

    Public Function ObtieneBlImpoCabecera(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingImpoBE)
        Dim objListaBlList As List(Of BillOfLadingImpoBE) = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        objListaBlList = New List(Of BillOfLadingImpoBE)()
        objListaBlList = objBlImpoDALC.ObtieneBLImportacion(objBlImpoBE, bExito, sMensaje)

        Return objListaBlList
    End Function

    Public Function ListarBlImpoDesglose(ByVal objBlImpoBE As BillOfLadingImpoBE) As BillOfLadingImpoBE
        Dim objImpoDesgloseBlBE As BillOfLadingImpoBE = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        'objListaBlList = New List(Of BillOfLadingImpoBE)()
        objImpoDesgloseBlBE = objBlImpoDALC.ConsultarBLImportacionDesglose(objBlImpoBE)

        Return objImpoDesgloseBlBE
    End Function

    Public Function ObtieneBlImpoMercaderia(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingImpoBE)
        Dim objListaBlList As List(Of BillOfLadingImpoBE) = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        objListaBlList = New List(Of BillOfLadingImpoBE)()
        objListaBlList = objBlImpoDALC.ObtieneBLImpMercaderiaCab(objBlImpoBE, bExito, sMensaje)

        Return objListaBlList
    End Function

    Public Function ObtieneBlImpoMercaderiaDet(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef dt As DataTable, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingImpoBE)

        Dim objListaBlList As List(Of BillOfLadingImpoBE) = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        objListaBlList = New List(Of BillOfLadingImpoBE)()
        objListaBlList = objBlImpoDALC.ObtieneBLImpMercaderiaDet(objBlImpoBE, dt, bExito, sMensaje)

        Return objListaBlList
    End Function

    Public Function ObtieneBlImpoFlete(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef dt As DataTable, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingImpoBE)

        Dim objListaBlList As List(Of BillOfLadingImpoBE) = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        objListaBlList = New List(Of BillOfLadingImpoBE)()
        objListaBlList = objBlImpoDALC.ObtieneBLImpFlete(objBlImpoBE, dt, bExito, sMensaje)

        Return objListaBlList
    End Function

    Public Function ObtieneBlImpoContenedor(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef dt As DataTable, ByRef bExito As Boolean, ByRef sMensaje As String) As List(Of BillOfLadingImpoBE)

        Dim objListaBlList As List(Of BillOfLadingImpoBE) = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        objListaBlList = New List(Of BillOfLadingImpoBE)()
        objListaBlList = objBlImpoDALC.ObtieneBLImpContenedor(objBlImpoBE, dt, bExito, sMensaje)

        Return objListaBlList
    End Function


    Public Function ObtieneBlImpo_CodMax(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef iCodMaximo As Integer) As List(Of BillOfLadingImpoBE)
        Dim objListaBlList As List(Of BillOfLadingImpoBE) = Nothing
        Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing

        objBlImpoDALC = New BillOfLadingImpoDALC
        objListaBlList = New List(Of BillOfLadingImpoBE)()
        objListaBlList = objBlImpoDALC.ObtieneBLImportacion_MaxCod(objBlImpoBE, iCodMaximo)

        Return objListaBlList
    End Function



    Public Function EliminarBlImpo(ByVal objBlImpoBE As BillOfLadingImpoBE, ByRef bExito As Boolean, ByRef sMensaje As String) As Boolean

        Dim objScope As TransactionScope
        objScope = New TransactionScope


        Using objScope
            Try
                Dim objBlImpoDALC As BillOfLadingImpoDALC = Nothing
                objBlImpoDALC = New BillOfLadingImpoDALC

                objBlImpoDALC.EliminarBlImpo(objBlImpoBE, bExito, sMensaje)

                objScope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return bExito
    End Function

End Class
